package com.zy.controller;

import com.zy.Vo.GoodsVo;
import com.zy.Vo.ResultVo;
import com.zy.service.GoodsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Resource
    private GoodsService goodsService;
    @GetMapping("/pagelist/{pageNo}/{pageSize}")
    public ResultVo getGoodsPageList(@PathVariable Integer pageNo, @PathVariable Integer pageSize, GoodsVo goodsVo){
        return ResultVo.sucess(goodsService.getPageGoodsList(pageNo,pageSize,goodsVo));
    }
    @GetMapping("/goodsdel/{id}")
    public  ResultVo del(@PathVariable String id){
        try {
            goodsService.getGoodsDelete(Integer.parseInt(id));
            return ResultVo.sucess("角色删除成功!!!");
        }catch (Exception e){

            return ResultVo.fail("角色删除失败!!!",e);
        }
    }

}
